<template>
  <NConfigProvider
      :locale="zhCN"
      :date-locale="dateZhCN"
      class="w-full h-full"
  >
    <taoke>
      <router-view></router-view>
    </taoke>
  </NConfigProvider>
</template>

<script setup name="app" lang="ts">
import http from "@/request/request"
import type{AxiosResponse} from "axios"
// import toke from "@/components/toke/index.vue"
import {zhCN, dateZhCN, createTheme, inputDark, datePickerDark, darkTheme, useDialog} from 'naive-ui';
import {useUserInfo} from "./store/moduls/userinfo";
import {h} from "vue";

const userInfo = useUserInfo()
// 初始化的时候，获取一个匿名用户token，
const init = () => {
  if (userInfo.id) {
    console.log("目前有token，不需要空白用户")
    return
  }
  console.log("目前没有token，需要空白用户")
  http.anylogin().then((res:AxiosResponse) => {
    if (res.status === 200) {
      console.log(res, "匿名登录的结果")
      userInfo.denglu(res.data.data)
    }
  })
}

// 初始化区域
init()
</script>

<style>
* {
  margin: 0;
  padding: 0;
  list-style: none;
}

html, body, #app {
  margin-right: calc(100% - 100vw) !important;
  width: 100vw;
  height: 100vh;
  overflow-x: hidden;
  /*min-height: 600px;*/
}
</style>
